﻿using System.Linq;
using System.Collections.Generic;
using EDMDesigner.Business.CSDL.Property.Complex;
using EDMDesigner.Business.CSDL.Property.Scalar;

namespace EDMDesigner.Business.MSL.EntityType.ComplexType
{
    public class ComplexPropertyMapping : MappingBase
    {
        public ComplexPropertyMapping(Business.CSDL.Type.Entity.EntityType entityType, ComplexProperty complexProperty)
            : base(entityType)
        {
            ComplexProperty = complexProperty;
        }

        public ComplexProperty ComplexProperty { get; private set; }

        protected override MappingBase BaseMapping
        {
            get
            {
                if (EntityType.ComplexProperties.Contains(ComplexProperty))
                    return null;
                return EntityType.BaseType.Mapping;
            }
        }
    }
}
